import React from 'react';
import "./index.less"
import {
    InputItem,
    List,
    TabBar,
	Button,
	Modal
} from 'antd-mobile';
import TabBarExample from 'components/tabBar'
import TopBarExample from 'components/topBar'

const Item = List.Item;
const Brief = Item.Brief;
const alert = Modal.alert;

export default class OrderDetail extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            id: 0,
            shopCar: false,
            data: {}
        }
    }

    componentDidMount() {
        this.props.location.state ? this.setState({
            id: this.props.location.state.id,
            shopCar: this.props.location.state.shopCar
        }): null
    }


    // 返回上一页
    addVConsolePackage = () => {
        this.props.history.goBack()
    };
    
	goUrl = (res) => {
	    this.props.history.push({pathname:'/setting/info', state:{id:123}})
	};
	
	
    render() {
        return (
            <div className="setTing">
                <TopBarExample title={'设置'} autoBack={this.addVConsolePackage} showBack={true}></TopBarExample>
                <List renderHeader={() => 'Customized Right Side（Empty Content / Text / Image）'} className="my-list">
					<Item
					          thumb="https://zos.alipayobjects.com/rmsportal/dNuvNrtqUztHCwM.png"
					          arrow="horizontal"
					          onClick={this.goUrl}
					        >My name</Item>
				   <Item arrow="horizontal" onClick={() => {}}>地址管理</Item>
				   <Item extra='' arrow="horizontal" onClick={() => {}}>关于我们</Item>
				   <Item arrow="horizontal" onClick={() =>  alert('温馨提示', '是否要注销此账号？', [
					   { text: '取消', onPress: () => console.log('cancel') },
					   { text: '确定', onPress: () => console.log('ok') },
					 ])}>注销账号</Item>
				 </List>
				 <div className="footbottom">
				 <Button onClick={() =>  alert('温馨提示', '确定取消登录？', [
					   { text: '取消', onPress: () => console.log('cancel') },
					   { text: '确定', onPress: () => console.log('ok') },
					 ])
				   }
				 >
				 退出登录
				 </Button>
				 </div>
            </div>
        );
    }
}

